<!DOCTYPE html>
<html lang="en">


<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../../common/layui/css/layui.css">
<title>应用更新</title>

<head>
    <style>
        html,body{
            background-color: #445567;
        }
        .process {
            position: absolute;
            width: 80vw;
            left: 10vw;
            top: 30vh;
        }
        .tip {
            position: absolute;
            top: 50vh;
            text-align: center;
            width: 100vw;
            font-size: 20px;
            color: white;
        }
    </style>
</head>

<body>
    <div class="layui-progress layui-progress-big process" lay-showPercent="yes" lay-filter="updateProcess">
        <div class="layui-progress-bar layui-bg-green" lay-percent="0%"></div>
    </div>
    <div class="tip">检测到新版本,正在更新...</div>
</body>

</html>
<script>if (typeof module === 'object') { window.module = module; module = undefined; }</script>
<script src="../../../common/layui/layui.js"></script>
<script>
    layui.use(['element'], () => {
        const element = layui.element;
        const ipcRenderer = require('electron').ipcRenderer;
        ipcRenderer.on('autoUpdate', function (event, data) {
            console.log(data);
        });
        ipcRenderer.on('updateProcess', function (event, data) {
            console.log(data);
            element.progress('updateProcess', `${Math.ceil(data.percent)}%`);
        });

    })
</script>
<script>if (window.module) module = window.module;</script>